/*
 * @Description: 
 * @Author: mmzhang
 * @Date: 2023-01-06 17:10:24
 * @LastEditTime: 2023-01-09 11:43:07
 */
import dateOpt from '@/biz/option/date.js'
import table from '@/components/dt/table/render.js'

function options(_this) {
  return [
  {
    field: 'articleTitle',
    title: '文章标题',
    minWidth: 100,
    slots: {
      default: (params, h) => {
        if (_this.tabName != 0) {
          return table.cell.btn(_this, h, {
            title: params.row.articleTitle,
            event: 'labelTypeClick',
            data: params.row
          })
        } else {
          return table.cell.text(h, {
            value: params.row.articleTitle,
          })
        }
      }
    },
  },
  {
    field: 'housesName',
    title: '所属楼盘',
    minWidth: 150,
  },
  {
    field: 'createTime',
    title: '创建时间',
    minWidth: 120,
    header: {
      filter: dateOpt.range({
        title: '创建时间',
        startKey: 'submitTimeStartDate',
        endKey: 'submitTimeEndDate'
      })
    },
  },
  {
    field: 'createName',
    title: '创建人',
    minWidth: 140,
  },
  {
    field: 'handles',
    title: '操作',
    minWidth: 150,
    fixed: 'right',
    slots: {
      default: (params, h) => {
        let btns = []
        let item = params.row

        btns.push({
          title: '流程信息',
          event: 'processFun',
          data: item
        })

        btns.push({
          title: _this.unlocking('0107050100') && _this.tabName == '0' ? '审核' : '',
          event: 'reviewFun',
          data: item
        })

        btns.push({
          title: _this.tabName == '2' ? '查看驳回原因' : '',
          event: 'viewReason',
          data: params.row
        })
        return table.cell.btns(_this, h, btns)
      }
    }
  }]
}

export default {
  options,
}